/**
 * @version 1.0.0
 * @author fxg1997
*/
<template>
  <div class="pages_content table">
    <el-container>
      <el-header>
        <breaDcrumb />
      </el-header>
      <div class="header_right" @click="showCardNav = !showCardNav">
        <div class="title">搜索</div>
        <div>
          <div :class="{ 'arrowTransform': !showCardNav, 'arrowTransformReturn': showCardNav}">
            <i style="margin-right: 5px" class="el-icon-arrow-down"></i>
          </div>
        </div>
      </div>
      <div v-show="showCardNav" class="hr"></div>
      <el-collapse-transition>
        <div v-show="showCardNav">
          <div class="search">
            <span style="display: inline-block;margin-bottom: 10px;">
              <span style="margin-right: 12px">财务编码：</span>
              <el-input v-model="tableParam.financialCode" style="width: 200px" clearable placeholder="请输入" />
            </span>
            <span style="display: inline-block;margin-left: 24px">
              <span style="margin-right: 12px">工程名称:</span>
              <el-input v-model="tableParam.engineeringName" style="width: 200px" clearable placeholder="请输入" />
            </span>
            <el-button icon="el-icon-search" size="medium" class="bottom_all" @click="(tableParam.page = 1), gettableData()">查 询</el-button>
            <el-button size="medium" class="bottom_all_two" style="margin-left: 12px" @click="init()">重 置</el-button>
          </div>
        </div>
      </el-collapse-transition>
      <div class="hr"></div>
      <el-main style="display: flex;padding-top:10px">
        <div>
          <!-- <div class="card scroll"> -->
          <div class="card">
            <div v-loading="tableLoading" class="card_info" :style="style">
              <el-table :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width: 100%" :data="tableData" tooltip-effect="dark">
                <template v-for="(item, index2) in table">
                  <el-table-column v-if="item.status" :key="index2" :label="item.label" align="center" :min-width="item.width" :fixed="item.label =='操作'?'right':false">
                    <template slot-scope="scope">
                      <span v-if="item.label == '状态'">
                        <span v-if="scope.row.dataStatus == 0" style="color: #969799">未开票</span>
                        <span v-if="scope.row.dataStatus == 1" style="color: #00a754">已开票</span>
                      </span>
                      <div v-else-if="item.label == '操作'">
                        <el-button v-if="scope.row.dataStatus == 0" class="bottom_one" size="mini" @click="open(scope.row,'dialog1',false)">
                          开票
                        </el-button>
                        <el-button v-if="scope.row.dataStatus == 1" class="bottom_one" size="mini" @click="open(scope.row,'dialog1',true)">
                          查看
                        </el-button>

                      </div>
                      <span v-else>{{ scope.row[item.prop] }}</span>
                    </template>
                  </el-table-column>
                </template>
              </el-table>
            </div>
          </div>
        </div>
      </el-main>
      <div class="card_bottom">
        <div class="card_bottom_left">
          <div class="top_page_totle">总共{{ total }}条</div>
          <el-pagination :current-page.sync="tableParam.page" :page-size="tableParam.pageSize" layout="prev, pager, next, jumper" :total="total" @current-change="gettableData()"></el-pagination>
        </div>
        <div>
          <el-button size="mini" icon="el-icon-refresh-right" class="bottom_all_two" @click="gettableData">刷新</el-button>
        </div>
      </div>
    </el-container>
    <diaLog1 :dialog="dialog1" :low="low" @reset="reset" @submit="submit"></diaLog1>
  </div>
</template>

<script>
import mixin from "@/mixins/ICPSmixin.js";
// import { getDicsType } from "@/api/common.js";
// import { getUserInfo } from "@/utils/auth"
const diaLog1 = () => import("./dialog/engineeringNotes1")
import {
  queryPage
} from "@/api/internetSales/engineeringNotes.js";
export default {
  components: {
    diaLog1,
  },
  mixins: [mixin],
  data() {
    return {
      /*表格增删改查及下载接口*/
      queryPage: queryPage,
      /*表格数据*/
      table: [
        { label: "财务编码", width: "140", prop: "financialCode", status: true },
        { label: "工程名称", width: "120", prop: "engineeringName", status: true },
        { label: "合同单位", width: "120", prop: "contractUnit", status: true },
        { label: "发票类别", width: "120", prop: "invoiceCategory", status: true },
        { label: "申请金额", width: "120", prop: "applicantAmount", status: true },
        { label: "开票金额", width: "120", prop: "invoiceAmount", status: true },
        { label: "电子发票接收邮箱", width: "120", prop: "email", status: true },
        { label: "申请人", width: "120", prop: "applicant", status: true },
        { label: "申请时间", width: "140", prop: "applicantTime", status: true },
        { label: "状态", width: "120", prop: "", status: true },
        { label: "开票号", width: "120", prop: "invoiceNo", status: true },
        { label: "操作", width: "120", prop: "", status: true },
      ],
      pagesType: 0,
      dialog1: false,
      disabled: true,
      low: {}
    };
  },
  created() {
    /*存储拷贝的原初始化fromDate数据*/
    this.tableParam = { ...this.tableParam, financialCode: "", engineeringName: "" };
    this.gettableData();
  },
  methods: {
    chooseNav(index) {
      this.currenindex = index
    },
    open(low, key, disabled) {
      this.low = this.copy(low);
      this.disabled = disabled
      this[key] = true;
    },
    reset(key) {
      this[key] = false;
    },
    submit(key) {
      this[key] = false;
      this.gettableData();
    },
    /*重置数据,此方法必须存在，并且方发只重置条件*/
    init() {
      this.tableParam.financialCode = "";
      this.tableParam.engineeringName = "";
      this.gettableData();
    },
  },
};
</script>

<style lang="scss" scoped>
.el-input,
.el-select {
  width: 240px;
}
.tabtop {
  width: 381px;
}
</style>
